<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>笨阶乘</title>
</head>

<body>
  <script>
    const clumsy = function (n) {

      let res = cal(n);
      for (n -= 3; n > 0; n -= 3) {
        res += n--;
        res -= cal(n);
      }

      return res;
    };

    // 计算一组 a*b/c，返回结果
    function cal(a) {
      let res = a;
      if (--a > 0) res *= a;
      if (--a > 0) res = Math.floor(res / a);
      return res;
    }
    console.log(clumsy(4))
  </script>
</body>

</html>